﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Unbenanntes Dokument</title>
		<link type="text/css" href="jquery/css/ui-lightness/jquery-ui-1.8.12.custom.css" rel="stylesheet" />	

		<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
		<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.13/jquery-ui.min.js"></script>
        <style>
	#sortable { list-style-type: none; margin: 0; padding: 0; width: 35%; }
	#sortable li { margin: 0 3px 3px 3px; padding: 0.4em; padding-left: 1.5em; font-size: 1em; height: 9	0px; }
	#sortable li span { position: absolute; margin-left: -1.3em; }
	</style>
	<script>
	$(function() {
		$( "#sortable" ).sortable();
		$( "#sortable" ).disableSelection();
	});
	</script>

</head>
<?php

//MYSQL Verbindung herstellen
$verbindung = mysql_connect ("localhost","root", "passowort".mysql_error())
or die ("keine Verbindung möglich. Benutzername oder Passwort sind falsch");
mysql_select_db("jamestkirk") or die ("Die Datenbank existiert nicht.".mysql_error());

//Datenbankabfrage
if (isset($_GET["suche"])){
$ray = $_GET["eingabe"];
$abfrage = "SELECT * FROM articels WHERE MATCH (name,job) AGAINST ('$ray' IN BOOLEAN MODE)";
$ergebnis = mysql_query($abfrage);

echo '<div class="demo"><ul id="sortable">';

while($row = mysql_fetch_object($ergebnis))
   {
	   $name = "$row->job";
	   $filter = str_replace("###","<b>",$name);
	   echo "<li class='ui-state-default'><span class='ui-icon ui-icon-arrowthick-2-n-s'></span> $filter </li>";}
	   echo '</ul></div><!-- End demo -->';
}

//Neuen Datensatz erstellen
if (isset($_POST["neu"])){
$tag_create = $_POST["tag"];
$job = mysql_real_escape_string ($_POST["job"], $verbindung);
$sql = "INSERT INTO `articels` (`name`,`job`) VALUES ('$tag_create','$job')";	
$db_erg = mysql_query($sql);}
?>
<body>

</body>
</html>